<?php
namespace Home\Controller;
use Think\Controller;
class OrderDetController extends Controller {

    //返回订单详情
    public function getOrderlist($oid){

        $orderDetTab = M('Order_details');
        $where['oid'] = $oid;

        $orderDetRes = $orderDetTab->where($where)
                                    ->field('gid,price,num,total')
                                    ->select();
        if ($orderDetRes) {
            foreach ($orderDetRes as $key => $value) {
                $newKey = $orderDetRes[$key]['gid'];
                $newArr[$newKey] = $value;
            }
        }else{
            $newArr = array();
        }                            
        return $newArr;
    }

    //返回 订单 gid  没用待删除
    public function getOrderGid($oid){
        $orderDetTab = M('Order_details');
        $where['oid'] = $oid;

        $orderGid = $orderDetTab->where($where)->field('gid')->select();

        for ($i=0; $i < count($orderGid) ; $i++) { 
            $gid[] = $orderGid[$i]['gid'];
        }

        return $gid;
    }


}